
import { message } from 'ant-design-vue';
import { upload } from '@/api/oss';

const UploadPost = (file) => {
  return new Promise((resolve, reject) => {
    // console.log(file);
    upload(file).then(res => {
      resolve(res);
    });
  });
};

export function UploadImage(file, reportCode) {
  return new Promise((resolve, reject) => {
    const fileName = file.name;
    const formData = new FormData();
    formData.append('file', file, fileName);
    UploadPost(formData).then(res => {
      resolve(res);
    }).catch(err => {
      message.info('上传失败！ ');
      reject(err);
    });
  });
}
